package cn.bonoon.kernel.support.models;

import java.util.ArrayList;
import java.util.List;

import cn.bonoon.kernel.support.entities.Persistable;

public class ObjectCollection extends ArrayList<ObjectItem>{

	private static final long serialVersionUID = -4447964957151636203L;

	public static <T extends Persistable>ObjectCollection valueOf(List<T> entities, List<Long> sids){
		ObjectCollection oCollection = new ObjectCollection(entities.size());
		for(T entity : entities){
			oCollection.add(ObjectItem.valueOf(entity.getId(), entity, sids.contains(entity.getId())));
		}
		return oCollection;
	}
	
	public ObjectCollection(){}
	
	public ObjectCollection(int size){
		super(size);
	}
}
